﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FormControl.Modoles;

namespace FormControl
{
    public partial class frmMain : Form
    {
        Code encrption = new Code();
        public string Key;
        public string Plaintext;
        public string Ciphertext;
        public frmMain()
        {
            InitializeComponent();
        }

        private void frmMain_Load(object sender, EventArgs e)
        {

        }

        private void lableKey_Click(object sender, EventArgs e)
        {
            
        }

        private void textboxKey_TextChanged(object sender, EventArgs e)
        {
            Key = textboxKey.Text;
            encrption.Key = Key;
        }

        private void textboxPlaintext_TextChanged(object sender, EventArgs e)
        {
            Plaintext = textboxPlaintext.Text;
            Plaintext = Plaintext.Replace(" ", "");
            encrption.Plaintext = Plaintext;
        }
        private void buttonConvert_Click(object sender, EventArgs e)
        {
            encrption.ConvertToCiphertext();
        }

        private void labelCipher_Click(object sender, EventArgs e)
        {
           
        }

        private void textboxCiphertext_TextChanged(object sender, EventArgs e)
        {
            Ciphertext = string.Join("", encrption.Output());            
            textboxCiphertext.Text = Ciphertext;
        }
    }
}
